package com.chuangshu.chuangshuteam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chuangshu.chuangshuteam.dto.TeamMemberDTO;
import com.chuangshu.chuangshuteam.entity.Team;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Map;

@Mapper
public interface TeamMapper extends BaseMapper<Team> {

    /**
     * 分页查询团队成员
     */
    IPage<TeamMemberDTO> selectTeamMembers(
            Page<TeamMemberDTO> page,
            @Param("teamId") Long teamId,
            @Param("direction") String direction
    );

    /**
     * 统计各方向成员数量
     */
    Map<String, Integer> countByDirection(@Param("teamId") Long teamId);

    /**
     * 统计团队总成员数
     */
    Integer countTotalMembers(@Param("teamId") Long teamId);

    /**
     * 统计管理员数量
     */
    Integer countAdmins(@Param("teamId") Long teamId);
}